// 加载 views 目录下的所有组件
const modules = import.meta.glob('../views/*/*.vue')

export const loadComponent = (componentName: string) => {
  // 开发阶段，下面这样的懒加载写法没有问题
  //   return () => import(`../views/${componentName}`)

  const fullComponentPath = `../views/${componentName}.vue`

  const dynamicComponent = modules[fullComponentPath]

  return dynamicComponent
}
